package com.hhit.bigscreenbackmanage.controller.aqgl;

import cn.hutool.json.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hhit.bigscreenbackmanage.common.Response;
import com.hhit.bigscreenbackmanage.service.aqgl.AqglStatisticsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.ws.rs.POST;
import java.util.Map;

/**
 * @ClassName AqglStatisticsController
 * @Description 大屏_统计
 * @Author qianchengcheng
 * @Date 2021/7/26
 */
@RestController
@RequestMapping("/aqgl")
public class AqglStatisticsController {

    private static Logger log = LoggerFactory.getLogger(AqglStatisticsController.class);

    @Autowired
    private AqglStatisticsService aqglStatisticsService;

//    /**
//     * @Description: 当日风险管控
//     * @Author: qianchengcheng
//     * @Date: 2021/7/26 20:03
//     * @Param: [jsonObject]
//     * @Return: com.hhit.bigscreenbackmanage.common.Response
//     **/
//    @PostMapping("/getDayRiskManagement")
//    public Response getDayRiskManagement(@RequestBody JSONObject jsonObject){
//        try {
//            String cityName = jsonObject.getString("cityName");
//            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDayRiskManagement(cityName));
//        }catch (Exception e){
//            log.error("AqglStatisticsController.getDayRiskManagement Call Error",e);
//            return Response.createResponseByError("查询异常:"+e.getMessage());
//        }
//    }

//    /**
//     * @Description: 每日作业票
//     * @Author: qianchengcheng
//     * @Date: 2021/7/26 21:01
//     * @Param: [jsonObject]
//     * @Return: com.hhit.bigscreenbackmanage.common.Response
//     **/
//    @PostMapping("/getDayWorkTickets")
//    public Response getDayWorkTickets(@RequestBody JSONObject jsonObject){
//        try {
//            String cityName = jsonObject.getString("cityName");
//            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDayWorkTickets(cityName));
//        }catch (Exception e){
//            log.error("AqglStatisticsController.getDayWorkTickets Call Error",e);
//            return Response.createResponseByError("查询异常:"+e.getMessage());
//        }
//    }

    /**
     * @Description: 获取日一本账
     * @Author: qianchengcheng
     * @Date: 2021/7/27 13:00
     * @Param: [jsonObject]
     * @Return: com.hhit.bigscreenbackmanage.common.Response
     **/
    @PostMapping("/getDayAnAccount")
    public Response getDayAnAccount(@RequestBody JSONObject jsonObject){
        try {
            String cityName = jsonObject.getString("cityName");
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDayAnAccount(cityName));
        }catch (Exception e){
            log.error("AqglStatisticsController.getDayAnAccount Call Error",e);
            return Response.createResponseByError("查询异常");
        }
    }

//    /**
//     * @Description: 获取当日人员管控
//     * @Author: qianchengcheng
//     * @Date: 2021/7/27 16:41
//     * @Param: [jsonObject]
//     * @Return: com.hhit.bigscreenbackmanage.common.Response
//     **/
//    @PostMapping("/getDayPersonControl")
//    public Response getDayPersonControl(@RequestBody JSONObject jsonObject){
//        try {
//            String cityName = jsonObject.getString("cityName");
//            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDayPersonControl(cityName));
//        }catch (Exception e){
//            log.error("AqglStatisticsController.getDayPersonControl Call Error",e);
//            return Response.createResponseByError("查询异常");
//        }
//    }

    /**
     * @Description: 获取当日日报统计
     * @Author: qianchengcheng
     * @Date: 2021/7/27 20:16
     * @Param: [jsonObject]
     * @Return: com.hhit.bigscreenbackmanage.common.Response
     **/
    @PostMapping("/getDailyPaper")
    public Response getDailyPaper(@RequestBody JSONObject jsonObject){
        try {
            String cityName = jsonObject.getString("cityName");
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDailyPaper(cityName));
        }catch (Exception e){
            log.error("AqglStatisticsController.getDailyPaper Call Error",e);
            return Response.createResponseByError("查询异常");
        }
    }

    /**
     * @Description: 获取监督检查情况
     * @Author: qianchengcheng
     * @Date: 2021/7/28 9:06
     * @Param: [jsonObject]
     * @Return: com.hhit.bigscreenbackmanage.common.Response
     **/
    @PostMapping("/getSupervisionCheckSituation")
    public Response getSupervisionCheckSituation(@RequestBody JSONObject jsonObject){
        try {
            String cityName = jsonObject.getString("cityName");
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getSupervisionCheckSituation(cityName));
        }catch (Exception e){
            log.error("AqglStatisticsController.getSupervisionCheckSituation Call Error",e);
            return Response.createResponseByError("查询异常");
        }
    }

//    /**
//     * @Description: 获取月度风险完成情况
//     * @Author: qianchengcheng
//     * @Date: 2021/7/28 14:01
//     * @Param: [jsonObject]
//     * @Return: com.hhit.bigscreenbackmanage.common.Response
//     **/
//    @PostMapping("/getMonthlyRiskCompletion")
//    public Response getMonthlyRiskCompletion(@RequestBody JSONObject jsonObject){
//        try {
//            String cityName = jsonObject.getString("cityName");
//            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getMonthlyRiskCompletion(cityName));
//        }catch (Exception e){
//            log.error("AqglStatisticsController.getMonthlyRiskCompletion Call Error",e);
//            return Response.createResponseByError("查询异常");
//        }
//    }

    /**
     * @Description: 获取每日播报
     * @Author: qianchengcheng
     * @Date: 2021/7/28 14:22
     * @Param: [jsonObject]
     * @Return: com.hhit.bigscreenbackmanage.common.Response
     **/
    @PostMapping("/getDailyReport")
    public Response getDailyReport(@RequestBody JSONObject jsonObject){
        try {
            String cityName = jsonObject.getString("cityName");
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDailyReport(cityName));
        }catch (Exception e){
            log.error("AqglStatisticsController.getDailyReport Call Error",e);
            return Response.createResponseByError("查询异常");
        }
    }



    /**********************************根据e安全提供接口获取数据**********************************/

    /**
     * @Description: 当日风险管控
     * @Author: yaoxin
     * @Param: [jsonObject]
     * @Return: com.hhit.bigscreenbackmanage.common.Response
     **/
    @PostMapping("/getDayRiskManagement")
    public Response getDayRiskManagementTj(@RequestBody JSONObject jsonObject){
        try {
            String dataTime = jsonObject.getString("dataTime");
            Map<String,Object> resultMap = aqglStatisticsService.getDayRiskManagementTj(dataTime);
            log.info(resultMap.toString());
            return Response.createResponseBySuccess("查询成功",resultMap);
        }catch (Exception e){
            log.error("AqglStatisticsController.getDayRiskManagementTj Call Error",e);
            return Response.createResponseByError("查询异常:"+e.getMessage());
        }
    }

    /**
     * 当日风险管控明细
     * @param jsonObject
     * @return
     */
    @PostMapping("/getDayRiskManagementDetail")
    public Response getDayRiskManagementDetail(@RequestBody JSONObject jsonObject){
        try {
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDayRiskManagementDetail(jsonObject));
        }catch (Exception e){
            log.error("AqglStatisticsController.getDayWorkTicketsTj Call Error",e);
            return Response.createResponseByError("查询异常:"+e.getMessage());
        }
    }

    /**
     * @Description: 每日作业票
     * @Author: yaoxin
     * @Date: 2021/8/3 22:01
     * @Param: [jsonObject]
     * @Return: com.hhit.bigscreenbackmanage.common.Response
     **/
    @PostMapping("/getDayWorkTickets")
    public Response getDayWorkTicketsTj(@RequestBody JSONObject jsonObject){
        try {
            String dataTime = jsonObject.getString("dataTime");
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDayWorkTicketsTj(dataTime));
        }catch (Exception e){
            log.error("AqglStatisticsController.getDayWorkTicketsTj Call Error",e);
            return Response.createResponseByError("查询异常:"+e.getMessage());
        }
    }

    /**
     * 作业票明细
     * @param jsonObject
     * @return
     */
    @PostMapping("/getDayWorkTicketsDetail")
    public Response getDayWorkTicketsDetail(@RequestBody JSONObject jsonObject){
        try {
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDayWorkTicketsDetail(jsonObject));
        }catch (Exception e){
            log.error("AqglStatisticsController.getDayWorkTicketsTj Call Error",e);
            return Response.createResponseByError("查询异常:"+e.getMessage());
        }
    }

    /**
     * @Description: 获取当日人员管控
     * @Author: yaoxin
     * @Date: 2021/8/4 09:23
     * @Param: [jsonObject]
     * @Return: com.hhit.bigscreenbackmanage.common.Response
     **/
    @PostMapping("/getDayPersonControl")
    public Response getDayPersonControl(@RequestBody JSONObject jsonObject){
        try {
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDayPersonControlTj(jsonObject));
        }catch (Exception e){
            log.error("AqglStatisticsController.getDayPersonControlTj Call Error",e);
            return Response.createResponseByError("查询异常");
        }
    }

    @PostMapping("/getDayPersonPageInfo")
    public Response getDayPersonPageInfo(@RequestBody JSONObject jsonObject){
        try {
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDayPersonPageInfo(jsonObject));
        }catch (Exception e){
            log.error("AqglStatisticsController.getDayPersonPageInfo Call Error",e);
            return Response.createResponseByError("查询异常");
        }
    }

    /**
     * 获取月度风险完成情况
     * @param jsonObject
     * @return
     */
    @PostMapping("/getMonthlyRiskCompletion")
    public Response getMonthlyRiskCompletionTj(@RequestBody JSONObject jsonObject){
        try {
            String dataTime = jsonObject.getString("dataTime");
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getMonthlyRiskCompletionTj(dataTime));
        }catch (Exception e){
            log.error("AqglStatisticsController.getMonthlyRiskCompletionTj Call Error",e);
            return Response.createResponseByError("查询异常");
        }
    }

    /**
     * 当日风险forGis
     * @param jsonObject
     * @return
     */
    @PostMapping("/getDayRiskForGis")
    public Response getDayRiskForGis(@RequestBody JSONObject jsonObject){
        try {
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDayRiskForGis(jsonObject));
        }catch (Exception e){
            log.error("AqglStatisticsController.getDayRiskForGis Call Error",e);
            return Response.createResponseByError("查询异常:"+e.getMessage());
        }
    }


    /**
     * 当日风险在施工程明细
     * @param jsonObject
     * @return
     */
    @PostMapping("/getDayRiskInBuildingDetail")
    public Response getDayRiskInBuildingDetail(@RequestBody JSONObject jsonObject){
        try {
            return Response.createResponseBySuccess("查询成功",aqglStatisticsService.getDayRiskInBuildingDetail(jsonObject));
        }catch (Exception e){
            log.error("AqglStatisticsController.getDayRiskInBuildingDetail Call Error",e);
            return Response.createResponseByError("查询异常:"+e.getMessage());
        }
    }

}
